<template>
	<view :style="{height: Height+'px'}" class="apply">
		<image class="headImg" src="https://xb-street.oss-cn-shanghai.aliyuncs.com/xb-doctor-manage/static/images/diceng@2x.png" mode=""></image>
		<view class="applycontent">
			<view class="boxphotot">
				<image class="applyImg1" src="https://xb-street.oss-cn-shanghai.aliyuncs.com/xb-doctor-manage/static/images/cytj@2x.png" mode=""></image>
			</view>
			<view class="condition">
				<view class="" style="width: 476rpx; margin: 0 auto;">
					<view class="">·陪诊从业人员发展三个新人参与陪诊服务 </view>
					<view class="">·缴纳1万元即可申请高级陪诊员</view> 
				</view>
			</view>
			<view class="boxphotot">
				<image class="applyImg1" src="https://xb-street.oss-cn-shanghai.aliyuncs.com/xb-doctor-manage/static/images/cyhb@2x.png" mode=""></image>
			</view>
			<view class="condition d-jc-c d-ai-c">
				<view class="ml-4">
					·赠送价值1万元铂金卡一张
				</view> 
				<view class="ml-4">·发展会员，享有会员卡销售10%的佣金 </view> 
				<view class="ml-4">·发展的会员在平台购物，可享有3%的佣金 </view> 
				<view class="ml-4">·推荐的陪诊人员接单服务，每单享有5元管理费</view> 
			</view>
			<view class="btn" @tap="wxdrawings">
				10000元立即报名
			</view>
			<view class="rule" @click='chgStatus()' >
				<label>
					<radio :checked="checked" color='#FA993A ' class="form-radio"/>
					登录代表您已同意 <text class="colorOrange" @click.stop="jumpTo"> 《相伴医路用户协议》</text>
				</label>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				Height:400,
				checked:true,
			}
		},
		onReady() {
			let that = this;
			uni.getSystemInfo({ //调用uni-app接口获取屏幕高度
				success(res) { //成功回调函数
					that.Height = res.windowHeight - uni.upx2px(0) //windoHeight为窗口高度，主要使用的是这个
				}
			})
		},
		methods: {
			jumpTo(){
				uni.navigateTo({
					url:'Platformstatement'
				})
			},
			chgStatus(){
				if(this.checked){
					 this.checked = false;
				}else{
					this.checked = true;
				}
			},
			wxdrawings(){
				if(this.checked!==true){
					uni.showToast({
						title: '请勾选用户协议',
						duration: 500,
						icon: "none"
					});
					return
				}
				let _this = this
				uni.showModal({
				    title: '提示',
				    content: '确认是否要申请',
				    success: function (res) {
				        if (res.confirm) {
							_this.apply()
				        } else if (res.cancel) {
				            console.log('用户点击取消');
				        }
				    }
				});
				
			},
			apply(){
				this.$api.wxpax({
					payType:6
				}).then((res) => {
					uni.requestPayment({
					appId:res.data.dataMap.appid,
				    provider: 'wxpay',
				    timeStamp:res.data.dataMap.timeStamp,
				    nonceStr: res.data.dataMap.nonceStr,
				    package: res.data.dataMap.package,
				    signType: 'MD5',
				    paySign: res.data.dataMap.paySign,
				    success: function (res) {
				        console.log('success:' + JSON.stringify(res));
						uni.showToast({
							title: '支付成功',
							duration: 500,
							icon: "none"
						});	
						uni.navigateBack({
							delta:1
						})
				    },
				    fail: function (err) {
				       uni.showToast({
				       	title: '支付失败',
				       	duration: 500,
				       	icon: "none"
				       });
				    }
				});
				})
				
			},
		}
	}
</script>

<style scoped lang="less">
	.apply{
		background: #FED202;
		.headImg{
			width: 750rpx;
			height: 360rpx;
		}
		.applycontent{
			width: 690rpx;
			// height: 971rpx;
			padding-bottom: 50rpx;
			margin: 0 auto;
			background: url(https://xb-street.oss-cn-shanghai.aliyuncs.com/xb-doctor-manage/static/images/bai@2x.png) no-repeat;
			
			background-size: 100% 100%;
			// text-align: center;
			.boxphotot{
				text-align: center;
				.applyImg1{
					width: 412rpx;
					height: 80rpx;	
					margin-top: 50rpx;
				}
			}
			.condition{
				width: 620rpx;
				padding: 20rpx 0;
				background: #FA993A;
				border: 2rpx solid #FED202;
				border-radius: 20rpx;
				margin: 0 auto;
				margin-top: 30rpx;
				font-size: 26rpx;
				font-weight: 500;
				color: #FFFFFF;
				line-height: 48rpx;
			}
			.btn{
				width: 606rpx;
				height: 108rpx;
				border-radius: 60rpx;
				background-color: #FA993A;
				margin: 0 auto;
				margin-top: 50rpx;
				line-height: 108rpx;
				text-align: center;
				font-size: 32rpx;
				font-weight: 500;
				color: #FFFFFF;
			}
			.rule{font-size: 24rpx;color:#999999;text-align: center;margin:10px 0}
		}
		
	}

</style>
